<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Ananas Library: Исходный файл adatabase_old.h</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Создано системой Doxygen 1.5.6 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Титульная&nbsp;страница</span></a></li>
      <li><a href="annotated.html"><span>Классы</span></a></li>
      <li class="current"><a href="files.html"><span>Файлы</span></a></li>
    </ul>
  </div>
<h1>adatabase_old.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/****************************************************************************</span>
<a name="l00002"></a>00002 <span class="comment">** $Id: adatabase_old.h,v 1.1 2007/03/17 11:12:35 leader Exp $</span>
<a name="l00003"></a>00003 <span class="comment">**</span>
<a name="l00004"></a>00004 <span class="comment">** Header file of the ananas database of Ananas</span>
<a name="l00005"></a>00005 <span class="comment">** Designer and Engine applications</span>
<a name="l00006"></a>00006 <span class="comment">**</span>
<a name="l00007"></a>00007 <span class="comment">** Created : 20031201</span>
<a name="l00008"></a>00008 <span class="comment">**</span>
<a name="l00009"></a>00009 <span class="comment">** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.</span>
<a name="l00010"></a>00010 <span class="comment">** Copyright (C) 2003-2005 Grigory Panov &lt;gr1313 at mail dot ru &gt;, Yoshkar-Ola</span>
<a name="l00011"></a>00011 <span class="comment">**</span>
<a name="l00012"></a>00012 <span class="comment">** This file is part of the Library of the Ananas</span>
<a name="l00013"></a>00013 <span class="comment">** automation accounting system.</span>
<a name="l00014"></a>00014 <span class="comment">**</span>
<a name="l00015"></a>00015 <span class="comment">** This file may be distributed and/or modified under the terms of the</span>
<a name="l00016"></a>00016 <span class="comment">** GNU General Public License version 2 as published by the Free Software</span>
<a name="l00017"></a>00017 <span class="comment">** Foundation and appearing in the file LICENSE.GPL included in the</span>
<a name="l00018"></a>00018 <span class="comment">** packaging of this file.</span>
<a name="l00019"></a>00019 <span class="comment">**</span>
<a name="l00020"></a>00020 <span class="comment">** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE</span>
<a name="l00021"></a>00021 <span class="comment">** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.</span>
<a name="l00022"></a>00022 <span class="comment">**</span>
<a name="l00023"></a>00023 <span class="comment">** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru</span>
<a name="l00024"></a>00024 <span class="comment">** See http://www.leaderit.ru/gpl/ for GPL licensing information.</span>
<a name="l00025"></a>00025 <span class="comment">**</span>
<a name="l00026"></a>00026 <span class="comment">** Contact org@leaderit.ru if any conditions of this licensing are</span>
<a name="l00027"></a>00027 <span class="comment">** not clear to you.</span>
<a name="l00028"></a>00028 <span class="comment">**</span>
<a name="l00029"></a>00029 <span class="comment">**********************************************************************/</span>
<a name="l00030"></a>00030 
<a name="l00031"></a>00031 <span class="preprocessor">#ifndef ADATABASE_H</span>
<a name="l00032"></a>00032 <span class="preprocessor"></span><span class="preprocessor">#define ADATABASE_H</span>
<a name="l00033"></a>00033 <span class="preprocessor"></span><span class="preprocessor">#include &lt;qobject.h&gt;</span>
<a name="l00034"></a>00034 <span class="preprocessor">#include &lt;qstringlist.h&gt;</span>
<a name="l00035"></a>00035 <span class="preprocessor">#include &lt;qsqldatabase.h&gt;</span>
<a name="l00036"></a>00036 <span class="preprocessor">#include &lt;qdict.h&gt;</span>
<a name="l00037"></a>00037 <span class="preprocessor">#include "acfg.h"</span>
<a name="l00038"></a>00038 <span class="preprocessor">#include &lt;qwidget.h&gt;</span>
<a name="l00039"></a>00039 
<a name="l00040"></a>00040 
<a name="l00041"></a>00041 <span class="preprocessor">#define db_document_header      "dh%1"</span>
<a name="l00042"></a>00042 <span class="preprocessor"></span><span class="preprocessor">#define db_document_table       "dt%1_%2"</span>
<a name="l00043"></a>00043 <span class="preprocessor"></span><span class="preprocessor">#define db_catalog_element      "ce%1"</span>
<a name="l00044"></a>00044 <span class="preprocessor"></span><span class="preprocessor">#define db_catalog_group        "cg%1"</span>
<a name="l00045"></a>00045 <span class="preprocessor"></span><span class="preprocessor">#define db_iregister            "ri%1"</span>
<a name="l00046"></a>00046 <span class="preprocessor"></span><span class="preprocessor">#define db_aregister            "ra%1"</span>
<a name="l00047"></a>00047 <span class="preprocessor"></span><span class="preprocessor">#define db_areg_remainder       "ra%1_rem"</span>
<a name="l00048"></a>00048 <span class="preprocessor"></span><span class="preprocessor">#define db_user_roles           "usr_rl"</span>
<a name="l00049"></a>00049 <span class="preprocessor"></span><span class="preprocessor">#define db_users                "usr"</span>
<a name="l00050"></a>00050 <span class="preprocessor"></span><span class="preprocessor">#define db_roles                "rl"</span>
<a name="l00051"></a>00051 <span class="preprocessor"></span><span class="preprocessor">#define db_right_roles          "r_rl"</span>
<a name="l00052"></a>00052 <span class="preprocessor"></span><span class="preprocessor">#define db_indices              "idc"</span>
<a name="l00053"></a>00053 <span class="preprocessor"></span><span class="preprocessor">#define db_areg_dim             "ra%1_d%2"</span>
<a name="l00054"></a>00054 <span class="preprocessor"></span>
<a name="l00055"></a>00055 <span class="keyword">class </span><a class="code" href="classaDatabase.html" title="Класс для работы с СУБД. Ananas Data Abstraction Layer. Наследует...">aDatabase</a>;
<a name="l00056"></a>00056 <span class="keyword">class </span><a class="code" href="classaCfgRc.html">aCfgRc</a>;
<a name="l00057"></a>00057 <span class="keyword">class </span><a class="code" href="classaDataTable.html" title="Определяет программный интерфейс модели данных...">aDataTable</a>;
<a name="l00058"></a>00058 
<a name="l00059"></a>00059 <span class="comment">//extern aDatabase database;</span>
<a name="l00060"></a>00060 
<a name="l00073"></a><a class="code" href="classaDataDriver.html">00073</a> <span class="keyword">class </span><a class="code" href="classaDataDriver.html" title="Базовый класс для драйверов баз данных. Наследует...">aDataDriver</a>: <span class="keyword">public</span> QObject
<a name="l00074"></a>00074 {
<a name="l00075"></a>00075         Q_OBJECT
<a name="l00076"></a>00076 <span class="keyword">public</span>:
<a name="l00077"></a>00077         <a class="code" href="classaDataDriver.html" title="Базовый класс для драйверов баз данных. Наследует...">aDataDriver</a>();
<a name="l00078"></a>00078         ~<a class="code" href="classaDataDriver.html" title="Базовый класс для драйверов баз данных. Наследует...">aDataDriver</a>();
<a name="l00079"></a>00079 };
<a name="l00080"></a>00080 
<a name="l00081"></a>00081 
<a name="l00082"></a>00082 <span class="keyword">class </span>aDataDriver_SQLITE: <span class="keyword">public</span> <a class="code" href="classaDataDriver.html" title="Базовый класс для драйверов баз данных. Наследует...">aDataDriver</a>
<a name="l00083"></a>00083 {
<a name="l00084"></a>00084         Q_OBJECT
<a name="l00085"></a>00085 <span class="keyword">public</span>:
<a name="l00086"></a>00086         aDataDriver_SQLITE();
<a name="l00087"></a>00087         ~aDataDriver_SQLITE();
<a name="l00088"></a>00088 
<a name="l00089"></a>00089 };
<a name="l00090"></a>00090 
<a name="l00091"></a>00091 <span class="keyword">class </span>aDataDriver_MYSQL: <span class="keyword">public</span> <a class="code" href="classaDataDriver.html" title="Базовый класс для драйверов баз данных. Наследует...">aDataDriver</a>
<a name="l00092"></a>00092 {
<a name="l00093"></a>00093         Q_OBJECT
<a name="l00094"></a>00094 <span class="keyword">public</span>:
<a name="l00095"></a>00095         aDataDriver_MYSQL();
<a name="l00096"></a>00096         ~aDataDriver_MYSQL();
<a name="l00097"></a>00097 
<a name="l00098"></a>00098 };
<a name="l00099"></a>00099 
<a name="l00100"></a>00100 
<a name="l00101"></a>00101 <span class="keyword">class </span>aDataDriver_PGSQL: <span class="keyword">public</span> <a class="code" href="classaDataDriver.html" title="Базовый класс для драйверов баз данных. Наследует...">aDataDriver</a>
<a name="l00102"></a>00102 {
<a name="l00103"></a>00103         Q_OBJECT
<a name="l00104"></a>00104 <span class="keyword">public</span>:
<a name="l00105"></a>00105         aDataDriver_PGSQL();
<a name="l00106"></a>00106         ~aDataDriver_PGSQL();
<a name="l00107"></a>00107 
<a name="l00108"></a>00108 };
<a name="l00109"></a>00109 
<a name="l00110"></a>00110 
<a name="l00123"></a>00123 <span class="keyword">class  </span>ANANAS_EXPORT <a class="code" href="classaDatabase.html" title="Класс для работы с СУБД. Ananas Data Abstraction Layer. Наследует...">aDatabase</a>: <span class="keyword">public</span> QObject
<a name="l00124"></a>00124 {
<a name="l00125"></a>00125         Q_OBJECT
<a name="l00126"></a>00126 
<a name="l00127"></a>00127 <span class="keyword">public</span> slots:
<a name="l00128"></a>00128 <span class="keyword">public</span>:
<a name="l00130"></a><a class="code" href="classaDatabase.html#64e4a15223f0cc0bc20bf833b9301acf">00130</a>         <span class="keyword">enum</span> <a class="code" href="classaDatabase.html#64e4a15223f0cc0bc20bf833b9301acf" title="Перечисление поддерживаемых типов баз данных...">dbServer</a>
<a name="l00131"></a>00131         {
<a name="l00133"></a>00133         unknown,
<a name="l00135"></a>00135         mysql,
<a name="l00137"></a>00137         postgresql,
<a name="l00139"></a>00139         odbc,
<a name="l00141"></a>00141         oracle,
<a name="l00143"></a>00143         mssql,
<a name="l00145"></a>00145         sybase };
<a name="l00147"></a><a class="code" href="classaDatabase.html#2804e68252ad6e2d23a61e9ac26bf542">00147</a>         QSqlDatabase *ddb;
<a name="l00149"></a>00149         <a class="code" href="classaCfg.html" title="Класс реализует програмный интерфейс доступа...">aCfg</a> cfg;
<a name="l00150"></a>00150 
<a name="l00151"></a>00151         <a class="code" href="classaDatabase.html" title="Класс для работы с СУБД. Ananas Data Abstraction Layer. Наследует...">aDatabase</a>();
<a name="l00152"></a>00152         ~<a class="code" href="classaDatabase.html" title="Класс для работы с СУБД. Ananas Data Abstraction Layer. Наследует...">aDatabase</a>();
<a name="l00153"></a>00153         <span class="keywordtype">bool</span> init( <a class="code" href="classaCfgRc.html">aCfgRc</a> *rc, <span class="keyword">const</span> QString &amp;dbname = QString::null );
<a name="l00154"></a>00154         <span class="keywordtype">bool</span> init( <span class="keyword">const</span> QString &amp;rcname, <span class="keyword">const</span> QString &amp;dbname = QString::null );
<a name="l00155"></a>00155         <span class="keywordtype">void</span> done();
<a name="l00156"></a>00156         QSqlDatabase* db(<span class="keyword">const</span> QString &amp;dbname = QString::null );
<a name="l00157"></a>00157         <span class="keywordtype">bool</span> checkStructure();
<a name="l00158"></a>00158         <span class="keywordtype">bool</span> create();
<a name="l00159"></a>00159         <span class="keywordtype">bool</span> drop( <span class="keyword">const</span> QString &amp;);
<a name="l00160"></a>00160         <span class="keywordtype">bool</span> update();
<a name="l00161"></a>00161         Q_ULLONG uid( <span class="keywordtype">int</span> otype );
<a name="l00162"></a>00162 <span class="comment">//      int otype( Q_ULLONG uid );</span>
<a name="l00163"></a>00163         <span class="keywordtype">int</span> uidType ( Q_ULLONG uid );
<a name="l00164"></a>00164         <a class="code" href="classaDataTable.html" title="Определяет программный интерфейс модели данных...">aDataTable</a> *table( <span class="keyword">const</span> QString &amp; name = QString::null );
<a name="l00165"></a>00165         <span class="keywordtype">bool</span> tableExists( <span class="keyword">const</span> QString &amp; name );
<a name="l00166"></a>00166         <span class="keywordtype">void</span> markDeleted(Q_ULLONG uid);
<a name="l00167"></a>00167         <span class="keywordtype">void</span> deleteMarked();
<a name="l00168"></a>00168         QString driverName();
<a name="l00169"></a>00169 
<a name="l00170"></a>00170 <span class="comment">//      static QString tableDbName( aCfg &amp;md, aCfgItem context, long * tid = 0 );</span>
<a name="l00171"></a>00171         <span class="keyword">static</span> QStringList supportedDriverList();
<a name="l00172"></a>00172         <span class="keyword">static</span> QStringList getUniqueIndices(<span class="keyword">const</span> QString &amp; flddef);
<a name="l00173"></a>00173 
<a name="l00174"></a>00174         <span class="keyword">static</span> QString tableDbName( <a class="code" href="classaCfg.html" title="Класс реализует програмный интерфейс доступа...">aCfg</a> &amp;md, aCfgItem context, <span class="keywordtype">long</span> * tid);
<a name="l00175"></a>00175         <span class="keyword">static</span> QString tableDbName( <a class="code" href="classaCfg.html" title="Класс реализует програмный интерфейс доступа...">aCfg</a> &amp;md, aCfgItem context);
<a name="l00176"></a>00176 
<a name="l00177"></a>00177         <span class="keywordtype">bool</span> exchangeDataSystables       ( QDomDocument &amp;xml, <span class="keywordtype">bool</span> <span class="keyword">import</span> );
<a name="l00178"></a>00178         <span class="keywordtype">bool</span> exchangeDataCatalogues      ( QDomDocument &amp;xml, <span class="keywordtype">bool</span> <span class="keyword">import</span> );
<a name="l00179"></a>00179         <span class="keywordtype">bool</span> exchangeDataDocuments       ( QDomDocument &amp;xml, <span class="keywordtype">bool</span> <span class="keyword">import</span> );
<a name="l00180"></a>00180         <span class="keywordtype">bool</span> exchangeDataJournals        ( QDomDocument &amp;xml, <span class="keywordtype">bool</span> <span class="keyword">import</span> );
<a name="l00181"></a>00181         <span class="keywordtype">bool</span> exchangeDataInfoRegisters   ( QDomDocument &amp;xml, <span class="keywordtype">bool</span> <span class="keyword">import</span> );
<a name="l00182"></a>00182         <span class="keywordtype">bool</span> exchangeDataAccumulationRegisters   ( QDomDocument &amp;xml, <span class="keywordtype">bool</span> <span class="keyword">import</span> );
<a name="l00183"></a>00183         <span class="keywordtype">bool</span> exchangeDataUniques         ( QDomDocument &amp;xml, <span class="keywordtype">bool</span> <span class="keyword">import</span> );
<a name="l00184"></a>00184 
<a name="l00185"></a>00185 
<a name="l00186"></a>00186 <span class="keyword">private</span>:
<a name="l00187"></a>00187         <span class="keywordtype">bool</span> exportTableData(QDomDocument&amp; xml, <span class="keyword">const</span> QString &amp;tableName);
<a name="l00188"></a>00188         <span class="keywordtype">bool</span> importTableData(QDomDocument&amp; xml, <span class="keyword">const</span> QString &amp;tableName);
<a name="l00189"></a>00189         <span class="keywordtype">void</span> reportError(QSqlError er, <span class="keyword">const</span> QString &amp;query);
<a name="l00190"></a>00190         
<a name="l00191"></a>00191         QString fieldtype( <span class="keyword">const</span> QString &amp;tdef );
<a name="l00192"></a>00192         <span class="keywordtype">void</span> checkIndices(<span class="keyword">const</span> QString &amp;table, <span class="keyword">const</span> QString &amp;flddef, QStringList &amp;ui_add, QStringList &amp;ui_drop);
<a name="l00193"></a>00193         <span class="keywordtype">bool</span> isExists(<span class="keyword">const</span> QString fname, QStringList *f_lst, QString &amp;match);
<a name="l00194"></a>00194         QString fieldsDef( aCfgItem context, <span class="keyword">const</span> QString &amp;idx=QString::null);
<a name="l00195"></a>00195         QString sysFieldsDef ( aCfgItem context );
<a name="l00196"></a>00196         QString convFieldsDef( <span class="keyword">const</span> QString flddef, QString &amp;idxdef, QString &amp;pkey );
<a name="l00197"></a>00197         <span class="keywordtype">bool</span> createdb( <span class="keywordtype">bool</span> update );
<a name="l00198"></a>00198         <span class="keywordtype">bool</span> createIndexes(<span class="keyword">const</span> QString &amp;table, <span class="keyword">const</span> QString &amp;indexl, <span class="keyword">const</span> QStringList &amp; uidc=QStringList());
<a name="l00199"></a>00199         <span class="keywordtype">bool</span> dropIndexes(<span class="keyword">const</span> QString &amp;table, <span class="keyword">const</span> QStringList &amp;indices=QStringList());
<a name="l00200"></a>00200         <span class="keywordtype">bool</span> verifyTable( <span class="keyword">const</span> QString &amp;table, <span class="keyword">const</span> QString &amp;flddef,
<a name="l00201"></a>00201         QString &amp;f_drop, QString &amp;f_add, QString &amp;f_upd,
<a name="l00202"></a>00202         QString &amp;i_drop, QString &amp;i_add, QStringList &amp; ui_drop, QStringList &amp; ui_add);
<a name="l00203"></a>00203         <span class="keywordtype">bool</span> createTable(<span class="keywordtype">int</span> update, <span class="keyword">const</span> QString table, QString flddef );
<a name="l00204"></a>00204         <span class="keywordtype">bool</span> createSystables( <span class="keywordtype">bool</span> update );
<a name="l00205"></a>00205         <span class="keywordtype">bool</span> createCatalogues( <span class="keywordtype">bool</span> update );
<a name="l00206"></a>00206         <span class="keywordtype">bool</span> createDocuments( <span class="keywordtype">bool</span> update );
<a name="l00207"></a>00207         <span class="keywordtype">bool</span> createJournals( <span class="keywordtype">bool</span> update );
<a name="l00208"></a>00208         <span class="keywordtype">bool</span> createInformationRegisters( <span class="keywordtype">bool</span> update );
<a name="l00209"></a>00209         <span class="keywordtype">bool</span> createAccumulationRegisters( <span class="keywordtype">bool</span> update );
<a name="l00210"></a>00210         <span class="keywordtype">bool</span> dumpTable( QDomDocument&amp; xml, <span class="keyword">const</span> QString &amp;tableName);
<a name="l00211"></a>00211         <span class="keywordtype">void</span> fillFeatures();
<a name="l00212"></a>00212         QString feature(<span class="keyword">const</span> QString&amp; fetureName);
<a name="l00213"></a>00213         
<a name="l00214"></a>00214         QMap&lt;QString, QString&gt; featuresMySQL, featuresSQLite, featuresPostgreSQL;
<a name="l00215"></a>00215 
<a name="l00216"></a>00216 };
<a name="l00217"></a>00217 
<a name="l00218"></a>00218 <span class="preprocessor">#endif</span>
</pre></div></div>
<hr size="1"><address style="text-align: right;"><small>Документация по Ananas Library. Последние изменения: Sun Feb 1 21:47:14 2009. Создано системой&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.6 </small></address>
</body>
</html>
